Imports System.Xml.Serialization

Public Class AssociationEnd
    Inherits XEntityModelElementWithDocumentationBase

    ''' <summary>Initializes an instance of the <see cref="Association" /> class.</summary>
    ''' <param name="namespace">The <see cref="XNamespace"/> of the new element.</param>
    Public Sub New(ByVal [namespace] As XNamespace)
        MyBase.New("End", [namespace].ToString())
    End Sub

    ''' <summary>Initializes an instance of the <see cref="AssociationEnd" /> class.</summary>
    ''' <param name="other">An <see cref="System.Xml.Linq.XElement"/> object to copy from.</param>
    Public Sub New(ByVal other As XElement)
        MyBase.New(other)
    End Sub

    Private __onDelete As OnActionCollection

    <AutoLoad()> _
    <XmlElement("OnDelete", GetType(OnAction))> _
    Public ReadOnly Property OnDeleteActions() As OnActionCollection
        Get
            If (__onDelete Is Nothing) Then
                __onDelete = New EdmxEditor.OnActionCollection(Me, MyBase.Name.Namespace, "OnDelete")
            End If
            Return __onDelete
        End Get
    End Property

    <XmlAttribute()> _
    Public Property Type() As String
        Get
            Return Me.@Type
        End Get
        Set(ByVal value As String)
            Me.@Type = value
        End Set
    End Property

    <XmlAttribute()> _
    Public Property Role() As String
        Get
            Return Me.@Role
        End Get
        Set(ByVal value As String)
            Me.@Role = value
        End Set
    End Property

    <XmlAttribute()> _
    Public Property Multiplicity() As Multiplicity
        Get
            Return GetEnumValueAttribute(GetType(Multiplicity), Me.Attribute(XName.Get("Multiplicity", MyBase.Name.NamespaceName)))
        End Get
        Set(ByVal value As Multiplicity)
            If (Me.Attribute(XName.Get("Multiplicity", MyBase.Name.NamespaceName)) Is Nothing) Then
                Me.Add(New XAttribute(XName.Get("Multiplicity", MyBase.Name.NamespaceName), ""))
            End If
            SetEnumValueAttribute(GetType(Multiplicity), Me.Attribute(XName.Get("Multiplicity", MyBase.Name.NamespaceName)), value)
        End Set
    End Property

End Class
